<?php defined('SYSPATH') or die('No direct script access.');
$ss         = Session::instance();
$mydatetime = Helper_MyDateTime::factory();
$arraylist  = Helper_ArrayList::factory();
$display    = Helper_DisplayItems::factory();

$r          = Request::current();
$action     = $r->uri2();

$kriteria   = $ss->get('kriteria');

$view = Arr::get($_REQUEST,'view');
?>

<SCRIPT language="JavaScript">
<!--
function validEmail(mail) {
			invalidChars = " /:"
			if (mail == "") {
				return (false);
			}
			for (i=0; i < invalidChars.length; i++) {
				badChar = invalidChars.charAt(i)
				if (mail.indexOf(badChar,0) != -1) {
					return (false);
				}
			}
			atPos = mail.indexOf("@", 1)
			if (atPos == -1) {
				return (false);
			}
			periodPos = mail.indexOf(".", atPos)
			if (periodPos == -1) {
				return (false);
			}
			if (periodPos + 3 > mail.length) {
				return (false);
			}
			return (true);
		}
		
function checkPost() {
			if (document.updatePost.nickname.value=="")
			{
				alert("Masukan Username !");
				document.updatePost.nickname.focus();
				return false;
			}
			
			if (document.updatePost.fullname.value=="")
			{
				alert("Masukan Nama Lengkap !");
				document.updatePost.fullname.focus();
				return false;
			}

			if (document.updatePost.userroles_key.value=="")
			{
				alert("Pilih Level Pengguna !");
				document.updatePost.userroles_key.focus();
				return false;
			}

			if (document.updatePost.hpassword.value=="")
			{
				alert("Masukan Password !");
				document.updatePost.hpassword.focus();
				return false;
			}
			
		}

function newPassword() {
			if (document.newPass.new_password.value=="")
			{
				alert("Password Tidak Boleh Kosong !!");
				document.newPass.new_password.focus();
				return false;
			}
			if (document.newPass.retype_password.value=="")
			{
				alert("Tulis Lagi Password Anda !");
				document.newPass.retype_password.focus();
				return false;
			}
			if (!(document.newPass.new_password.value==document.newPass.retype_password.value))
			{
				alert("Password Harus Sama !");
				document.newPass.retype_password.focus();
				return false;
			}
		}

//-->
</SCRIPT>

<?php if($view != 'print') { ?>
<?php 
	echo View::factory('module/apps_breadcrumb')
		->set('breadcrumbs',
			array(
				0=>array(
					'address'=>'index',
					'text'=>'Dashboard'
				),
				1=>array(
					'address'=>NULL,
					'text'=>"Laporan Penyelesaian Kerja"
				)
			)
		)
		->render();
?>

<?php echo View::factory('module/apps_message')->render(); ?>
<?php } ?>










<div class="row-fluid">
	<div class="span12">
		<div class="span5">
			<div class="row-fluid"> 
		</div>
			<?php if($view != 'print') { ?>
			<!-- User Data Starts -->
			<div class="row-fluid"> 
				<?php echo Form::open($action.URL::query(array()), array('class'=>'form-horizontal','enctype'=>'multipart/form-data','name'=>'updatePost', 'method'=>'GET'))?>
				<fieldset class="well">
				  <legend>Laporan Penyelesaian Kerja</legend>
					
					
					<div class="control-group">
						<label class="control-label" for="tgl_awal">periode</label>
						<div class="controls">
				    <?php
							echo Form::input ('tgl_awal', '',
							array(
								'id'=>'tgl_awal',
								'class'=>'span5',
								'placeholder'=>'tgl_awal'
							)
							);
						?>
						<script>
						  AnyTime.picker( "tgl_awal",
						    { format: "%Y-%m-%d"} );
						</script>
						s/d
						<?php
							echo Form::input ('tgl_akhir', '',
							array(
								'id'=>'tgl_akhir',
								'class'=>'span5',
								'placeholder'=>'tgl_akhir'
							)
							);
						?>
						<script>
						  AnyTime.picker( "tgl_akhir",
						    { format: "%Y-%m-%d"} );
						</script>
						</div>
					</div>

				  <?php echo Form::submit('submit','submit',array('class'=>'btn btn-small btn-inverse btn-primary pull-right')) ?>
				  <?php  
				  $tglawal = Arr::get($_REQUEST,'tglawal');
				  $tglakhir = Arr::get($_REQUEST,'tglakhir');
				  $id_pelanggan = Arr::get($_REQUEST,'id_pelanggan');
				  ?>
				  <a href="
				  	?tglawal=<?php echo (!empty($tglawal) ? $tglawal : NULL) ?>&tglakhir=<?php echo $tglakhir ?>&id_pelanggan=<?php echo $id_pelanggan ?>&view=print
				  " class="btn btn-inverse btn-primary pull-right" style="color: white;">print</a>
				</fieldset>
				<?php echo Form::close()?>
			</div>
			<!-- User Data End -->
			<?php } ?>
		</div>
		<div class="span7">
			<!-- Forms Starts -->
			<div class="row-fluid" style="height: 100%; overflow: auto; position: relative;">
				<!-- Main Container Starts -->
				<div class="span12 outer-well">
				
					<div class="row-fluid">
						
						<!-- Left Container Starts -->
						<div class="span12">
							
							<!-- User Table Starts -->
							<div class="row centered-margin">
								<div class="head-list">		
								</div>
								<div class="box" style="clear: right;">
									<div class="box-content">
										<table class="table table-bordered table-striped table-condensed table-hover" <?php echo ($view == 'print' ? 'style="width: 100%;" border="1" cellpadding="0" cellspacing="0"' : '') ?>>
										  <thead>
											  <tr>
												  <th width="100">ID Srt Penyelesaian Kerja</th>  
												  <th width="100">Tgl Penyelesaian</th>                                         
											  </tr>
										  </thead>   
										  <tbody>
										  	<?php $total =0; ?>
											<?php if(empty($lappenyelesaiankerjalists)) { ?>
											  <tr valign="middle">
											    <td colspan="6" valign="middle" style="text-align: center;"><strong>Tidak ada data tersedia.</strong></td>
											  </tr>
											<?php } else { ?>
											  <?php foreach($lappenyelesaiankerjalists as $lappenyelesaiankerjalist) { ?>
												<tr>
													<td><?php echo $lappenyelesaiankerjalist['id'] ?></td>
													<td><?php echo $mydatetime->mktime_from_sql($lappenyelesaiankerjalist['tgl_penyelesaian'],'d-m-Y') ?></td>
													
												</tr>
											  <?php } ?>
											<?php } ?>
										  </tbody>
										</table>
										
									</div>
								</div>
							</div>
							<!-- User Table End -->
						</div>
						<!-- Left Container End -->
					</div>
								
				</div>
				<!-- Main Container End -->
			</div>
			<!-- Forms End -->
		</div>
	</div>
</div>








